package com.example.assignment01_javaee.Service.Impl;

import com.example.assignment01_javaee.Dao.CustomerDao;
import com.example.assignment01_javaee.Entity.Customer;
import com.example.assignment01_javaee.Service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    CustomerDao customerDao;

    @Override
    //查询所有的customer
    public List<Customer> getAllCustomers(){
        return customerDao.getAllCustomers();
    }

    //根据customer id查找
    @Override
    public Customer getCustomerById(int customerId){
        return customerDao.getCustomerById(customerId);
    }

    //增加customer
    @Override
    public void createCustomer(Customer customer){
        customerDao.createCustomer(customer);
    }

    //更改customer数据
    @Override
    public void updateCustomer(Customer customer){
        customerDao.updateCustomer(customer);
    }

    //根据customer id删除
    @Override
    public void deleteCustomer(int customerId){
        customerDao.deleteCustomer(customerId);
    }
}
